import 'package:flutter/material.dart';

class Demo5 extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    return new Demo5State();
  }
}

class Demo5State extends State<Demo5> {
  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(
        title: new Text('Transform变换'),
      ),
      body: new ListView(
        children: <Widget>[
          new Row(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              new Container(
                margin: EdgeInsets.only(top: 30.0),
                color: Colors.black87,
                child: new Transform(
                  alignment: Alignment.topRight,// 对齐方式为对齐右上角，其实是Transform容器的右边界及上边界向父容器Container的右边界及上边界靠齐
                  transform: Matrix4.skewY(0.25),
                  child: new DecoratedBox(
                    decoration: BoxDecoration(
                      color: Colors.blueAccent
                    ),
                    child: new Padding(
                      padding: EdgeInsets.symmetric(vertical: 10.0, horizontal: 6.0),
                      child: Text('Matrix4.skewY(0.3)'),
                    ),
                  ),
                ),
              ),
            ],
          ),
          new Container(
            margin: EdgeInsets.only(top: 16.0),
            height: 160.0,
            color: Colors.blue,
            child: new Align(
              alignment: Alignment.bottomRight,
              child: new Text('alignment: Alignment.bottomRight'),
            ),
          ),
          new Container(
            margin: EdgeInsets.only(top: 16.0),
            width: 200.0,
            height: 160.0,
            color: Colors.blue,
            alignment: Alignment.topRight,
            child: new Container(
              color: Colors.red,
              padding: EdgeInsets.all(16.0),
              child: new Text('qweqweqeqwewq'),
            ),
          ),
          new ConstrainedBox(
            constraints: BoxConstraints(   
              minWidth: double.infinity         
            ),
            child: new Container(
              padding: EdgeInsets.all(10.0),
              width: 100.0,
              color: Colors.red,
              child: new Text('qweqeqqqwqweqwe'),
            ),
          ),
          new Container(
            child: new Container(
              constraints: BoxConstraints(),
              padding: EdgeInsets.all(10.0),
              color: Colors.red,
              child: new Text('qweqeqqqwqweqwe'),
            ),
          )
        ],
      ),
    );
  }
}